var express = require('express');
var router = express.Router();

var cityList = {
    "value": [
        {
            "code":"01",
            "zh_value":"南京"
        },
        {
            "code":"02",
            "zh_value":"上海"
        }
    ],
    "errorCode": "200",
    "message": null
};

var regionList = {};

var jobTypeList = {
    "value": [
        {
            "type":1,
            "zh_value":"家教"
        },
        {
            "type":2,
            "zh_value":"保安"
        },
        {
            "type":3,
            "zh_value":"派单"
        },
        {
            "type":4,
            "zh_value":"服务员"
        },
        {
            "type":5,
            "zh_value":"文员"
        },
        {
            "type":7,
            "zh_value":"客服"
        },
        {
            "type":8,
            "zh_value":"促销"
        },
        {
            "type":9,
            "zh_value":"安保"
        },
        {
            "type":10,
            "zh_value":"礼仪"
        },{
            "type":11,
            "zh_value":"外卖"
        },
        {
            "type":12,
            "zh_value":"实习"
        },
        {
            "type":6,
            "zh_value":"其他"
        }
    ],
    "errorCode": "200",
    "message": null
};

router.get("/getCityList", function(req, res){
    res.send(JSON.stringify(cityList));
});

router.get("/getRegionList", function(req, res){
    switch(req.query.cityCode) {
        case "01":
            regionList = {
                "value": [
                    {
                        "code":"01",
                        "zh_value":"江宁"
                    },
                    {
                        "code":"02",
                        "zh_value":"栖霞"
                    },
                    {
                        "code":"03",
                        "zh_value":"建邺"
                    },
                    {
                        "code":"04",
                        "zh_value":"鼓楼"
                    },
                    {
                        "code":"05",
                        "zh_value":"雨花台"
                    },
                    {
                        "code":"06",
                        "zh_value":"玄武"
                    },
                    {
                        "code":"07",
                        "zh_value":"高淳"
                    },
                    {
                        "code":"08",
                        "zh_value":"六合"
                    },
                    {
                        "code":"09",
                        "zh_value":"浦口"
                    },
                    {
                        "code":"10",
                        "zh_value":"秦淮"
                    },
                    {
                        "code":"11",
                        "zh_value":"溧水"
                    },
                    {
                        "code":"12",
                        "zh_value":"白下"
                    },
                    {
                        "code":"13",
                        "zh_value":"大厂"
                    },
                    {
                        "code":"14",
                        "zh_value":"下关"
                    }
                ],
                "errorCode": "200",
                "message": null
            };
            break;
        case "02":
            regionList = {
                "value": [
                    {
                        "code":"01",
                        "zh_value":"杨浦"
                    },
                    {
                        "code":"02",
                        "zh_value":"静安"
                    }
                ],
                "errorCode": "200",
                "message": null
            };
            break;
    }

    res.send(JSON.stringify(regionList));
});

router.get("/getJobTypeList", function(req, res){
    res.send(JSON.stringify(jobTypeList));
});

module.exports = router;